package com.wanhai.itm.wditm145.lov;

import com.wanhai.vo.itm.ITM3012VO;
import java.util.Comparator;
import org.zkoss.zul.GroupComparator;
import org.zkoss.zul.GroupsModelArray;

/**
 * @author Richard Shih
 */
public class PlanitemGroupsModel extends GroupsModelArray<ITM3012VO, Object, Object, Object> {
    private static Comparator<ITM3012VO> defComparator = new GroupComparator<ITM3012VO>() {
        public int compareGroup(ITM3012VO d, ITM3012VO d1) {
            return String.valueOf(d.getITEM_AP_TYPE()).compareTo(d1.getITEM_AP_TYPE());
        }

        public int compare(ITM3012VO o1, ITM3012VO o2) {
            if (o1.getITEM_AP_TYPE().equals(o2.getITEM_AP_TYPE())) {
                return 0;
            } else {
                return 1;
            }
        }
    };
    
    public PlanitemGroupsModel(ITM3012VO[] data) {
        super(data, defComparator);
    }

    public PlanitemGroupsModel(ITM3012VO[] data, int col) {
        super(data, defComparator, col);
    }

    public PlanitemGroupsModel(ITM3012VO[] data, int col, boolean clone) {
        super(data, defComparator, col, clone);
    }

    @Override
    protected Object createGroupHead(ITM3012VO[] groupdata, int index, int col) {
        return groupdata[0].getITEM_AP_TYPE();
    }

//    @Override
//    protected Object createGroupFoot(ITM3012VO[] groupdata, int index, int col) {
//        return  groupdata.length;
//    }

}
